import getData from './data'
import { ref, watch } from 'vue'

// 表格列数据
export const tableColumnList = ref(getData())

// 复选框组数据
export const labelList = ref([])

// 选中的列数据
export const selectLabel = ref([])

const getLabelList = () => {
  labelList.value = tableColumnList.value.map(item => item.label)
  selectLabel.value = [...labelList.value]
}
getLabelList()

// 监听selectLabel改变，重新计算得出
watch(selectLabel, (val) => {
  tableColumnList.value = getData().filter(item => val.includes(item.label))
})
